<!--
 * @Descripttion: 
 * @Author: YuZhenJing
 * @Date: 2020-01-21 10:08:55
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-05-14 14:43:11
 -->
<template>
  <div class="auth-test">
    <div style="height:calc(100vh - 149px)">
      <div style="width:800px;margin:0px auto;">
        <el-card class="box-card">
          <div slot="header" style="text-align:center">
            <el-button-group>
              <el-button
                :loading="saveLoading"
                icon="el-icon-refresh"
                type="primary"
                @click="testRequest"
                >业务系统安全测试</el-button
              >
            </el-button-group>
          </div>
          <div
            style="height:400px;width: 738px;padding: 10px;overflow-x: auto;"
          >
            <div class="msg-box" :class="{ show: resultMsg != '' }">
              <span v-text="resultMsg"></span>
            </div>
          </div>
        </el-card>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      saveLoading: false,
      resultMsg: ''
    }
  },
  methods: {
    testRequest() {
      this.saveLoading = true
      this.resultMsg = ''
      const options = this.$html.get(
        this.bodyRootUrl.example + 'test/out',
        {},
        { root: true }
      )
      options
        .then(data => {
          if (data.returnType == 'success') {
            this.resultMsg = JSON.stringify(data)
            this.saveLoading = false
          }
        })
        .catch(error => {
          this.saveLoading = false
          console.log('error:authTest/testRequest', error)
        })
    }
  }
}
</script>
